﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AccountingClient.AccountingServer
{
    partial class DTOAccount : System.ComponentModel.IEditableObject
    {
        private string backupAccName = null;
        private int backupId = 0;
        private bool editing = false;
        public void BeginEdit()
        {
            backupAccName = this.AccountName;
            backupId = this.Id;
            editing = true;
        }

        public void CancelEdit()
        {
            if (editing)
            {
                Id = backupId;
                AccountName = backupAccName;
                editing = false; 
            }
        }

        public void EndEdit()
        {
            if (editing)
            {
                backupAccName = this.AccountName;
                backupId = this.Id;
                editing = false; 
            }
        }

        public override string ToString()
        {
            return AccountName;
        }
    }
}
